﻿@using Newtouch.Infrastructure;
@{
    ViewBag.Title = "读卡方式";
    Layout = "~/Views/Shared/_Form.cshtml";
    var medicalInsurance = SysConfigReader.String("Outpatient_MedicalInsurance");

}
@Html.Partial("_YibaoCommonView")
<div style="float:left;">
    <input type="button" id="sk" name="sk" class="btn btn-primary" style="width:180px;height:40px;font-size:25px;margin-left:100px;margin-top:75.5px;" value="刷医保卡" onclick="skOnClick()" />
    <br />
    <input type="button" id="sm" name="sm" class="btn btn-primary" style="width:180px;height:40px;font-size:25px;margin-left:100px;margin-top:20px;" value="扫电子医保码" onclick="smOnClick()" /> <br />
    <input type="button" id="ck" name="ck" class="btn btn-primary" style="width:180px;height:40px;font-size:25px;margin-left:100px;margin-top:20px;" value="刷医保磁卡" onclick="ckOnClick()" />
</div>

<script type="text/javascript">
    var zyh = $.request('zyh');
    var ryfs = $.request('ryfs');
    var ydsfz = $.request('ydsfz');
    var newzyh = $.request('newzyh');
    var medicalInsurance = '@medicalInsurance';
    var zffs;
    function skOnClick(patid) {
        debugger;
        zffs = "sk"
        $.modalOpen({
            id: "ZFToYBForm",
            title: "自费转医保",
            url: "/PatientManage/Inpatient/ZFToYBForm?zyh=" + zyh + "&ryfs=" + ryfs + "&ydsfz=" + ydsfz + "&newzyh=" + newzyh + "&zffs=" + zffs,
            width: "550px",
            height: "380px",
            btn: ['', '关闭'],
            btnclass: ['', 'btn btn-danger'],
            success: function (iframeId) {
                $.modalClose();
            }

        });
    };

    function smOnClick(patid) {
        zffs = "sm";
        $.modalOpen({
            id: "sbkhInput",
            title: "卡号输入",
            url: "/OutpatientManage/OutpatientReg/OutPatientSbkhInput?t=" + Math.random() + "&medicalInsurance=" + medicalInsurance,
            width: "300px",
            height: "150px",
            callBack: function (iframeId) {
                top.frames[iframeId].PatSbkhData();
            }
        });

        //openform();
    };
    function ckOnClick(patid) {
        zffs = "ck";
        $.modalOpen({
            id: "sbkhInput",
            title: "卡号输入",
            url: "/OutpatientManage/OutpatientReg/OutPatientSbkhInput?t=" + Math.random() + "&medicalInsurance=" + medicalInsurance + "&topform=" + "1",
            width: "300px",
            height: "150px",
            callBack: function (iframeId) {
                top.frames[iframeId].PatSbkhData();
            }
        });
        //openform();
    };
    function openform(khxx) {
        $.modalOpen({
            id: "ZFToYBForm",
            title: "自费转医保",
            url: "/PatientManage/Inpatient/ZFToYBForm?zyh=" + zyh + "&ryfs=" + ryfs + "&ydsfz=" + ydsfz + "&newzyh=" + newzyh + "&zffs=" + zffs + "&khxx=" + khxx,
            width: "550px",
            height: "380px",
            btn: ['', '关闭'],
            btnclass: ['', 'btn btn-danger'],
            success: function (iframeId) {
                $.modalClose();
            }
        });
    }
    function readCard(khxx) {
        switch (medicalInsurance) {
            case "shanghai":
                openform(khxx.sbkh);
                break;
            case "tongyong"://通用使用国家医保
                var khxx = { "sbkh": "", "sfzh": "", "ecToken": "" };
                GetReadCardInfo(khxx);
                break;
            default:
                $.modalAlert("医保所属地未设置，请设置后再进行刷卡", 'warning');
                return;
        }
    }
</script>